package com.school.model.entity;

// default package
// Generated Sep 24, 2013 10:45:18 AM by Hibernate Tools 3.4.0.CR1

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

/**
 * Fach generated by hbm2java
 */
@Entity
@Table(name = "fach", catalog = "schoolapp")
public class Fach implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8490915793517550270L;
	private int id;
	private Integer note;
	private String name;
	private Set<Schueler> schuelers = new HashSet<>(0);

	public Fach() {
	}

	public Fach(int id) {
		this.id = id;
	}

	public Fach(int id, Integer note, String name, Set<Schueler> schuelers) {
		this.id = id;
		this.note = note;
		this.name = name;
		this.schuelers = schuelers;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "ID", unique = true, nullable = false)
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Column(name = "Note")
	public Integer getNote() {
		return this.note;
	}

	public void setNote(Integer note) {
		this.note = note;
	}

	@Column(name = "Name", length = 45)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@ManyToMany(fetch = FetchType.EAGER)
	@JoinTable(name = "schueler_has_fach", catalog = "schoolapp", joinColumns = { @JoinColumn(name = "Fach_ID", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "Schueler_ID", nullable = false, updatable = false) })
	public Set<Schueler> getSchuelers() {
		return this.schuelers;
	}

	public void setSchuelers(Set<Schueler> schuelers) {
		this.schuelers = schuelers;
	}
}
